﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrderBuyMain.ascx.cs" Inherits="ERP.Modules.OrderBuyMain" %>
<ext:Hidden ID="FormatTypeOrderBuy" runat="server" />
        <%--------------GridOrderBuyBuy-----------------%>
<ext:Panel ID="PanelOrderBuy" runat="server" Layout="Fit" Border="False">
    <Content>
        <ext:GridPanel
            ID="grOrderBuy"
            runat="server"
            Cls="grid-double"
            EnableColumnMove="true"
            BOrderBuy="False">
            <Store>
                <ext:Store
                    ID="StoreOrderBuy"
                    runat="server"
                    OnReadData="StoreOrderBuy_RefreshData"
                    PageSize="20">
                    <Model>
                        <ext:Model runat="server" IDProperty="Order_Buy_Id" GroupField="Customer_Name">
                            <Fields>
                                <ext:ModelField Name="Order_Id" Type="Int" />
                                <ext:ModelField Name="Order_Code" Type="String" />
                                <ext:ModelField Name="Customer_Name" Type="String" />
                                <ext:ModelField Name="Order_Buy_Code" Type="String" />
                                <ext:ModelField Name="Order_Buy_Description" Type="String" />
                                <ext:ModelField Name="Order_Buy_Tax_Code" Type="String" />
                                <ext:ModelField Name="Order_Buy_DateBegin" Type="Date" />
                                <ext:ModelField Name="Order_Buy_DateEnd" Type="Date" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:RowNumbererColumn Text="STT" runat="server" Width="30" Align="Center" />
                    <ext:Column runat="server" Text="Chứng từ mua" Width="150" DataIndex="Order_Buy_Code" Align="Center"></ext:Column>
                    <ext:Column runat="server" Text="Chứng từ đặt" Width="170" DataIndex="Order_Code" Align="Center">
                        <Renderer Fn="gridNull" />
                    </ext:Column>
                    <ext:Column runat="server" Text="Nhà cung cấp" Width="200" DataIndex="Customer_Name"></ext:Column>
                    <ext:Column runat="server" Text="Mã số thuế" Width="130" DataIndex="Order_Buy_Tax_Code"></ext:Column>
                    <ext:DateColumn runat="server" Text="Ngày mua hàng" Width="177" DataIndex="Order_Buy_DateBegin" Format="dd-MM-yyyy" Align="Right"></ext:DateColumn>
                    <ext:DateColumn runat="server" Text="Ngày giao" Visible="False" Width="100" DataIndex="Order_Buy_DateEnd" Format="dd-MM-yyyy" Align="Right"></ext:DateColumn>
                    <ext:Column runat="server" Text="Ghi chú" DataIndex="Order_Buy_Description"></ext:Column>
                </Columns>
            </ColumnModel>
            <Features>
                <ext:Grouping
                    runat="server" 
                    HideGroupedHeader="true"
                    GroupByText="Xem theo phân nhóm"
                    ShowGroupsText="Phân nhóm"
                    GroupHeaderTplString="{name} ({rows.length} danh mục con {[values.rows.length > 1 ? '' : '']})"
                    StartCollapsed="True" />
            </Features>
            <DirectEvents>
                <ItemDblClick OnEvent="OrderBuyDblClick">
                    <ExtraParams>
                        <ext:Parameter Name="Order_Buy_Id" Value="record.data.Order_Buy_Id" Mode="Raw" />
                    </ExtraParams>
                    <EventMask ShowMask="true" Msg="Đang tải..." />
                </ItemDblClick>
            </DirectEvents>
            <SelectionModel>
                <ext:CheckboxSelectionModel runat="server" Mode="Multi">
                    <Listeners>
                        <SelectionChange Handler="
                            if (selected.length == 0) {
                                #{btnEdit}.disable();
                                #{btnDel}.disable();
                                #{btnExport}.disable();
                            } else {
                                #{btnEdit}.enable();
                                #{btnDel}.enable();
                                #{btnExport}.enable();
                            }" />
                    </Listeners>
                </ext:CheckboxSelectionModel>
            </SelectionModel>
            <View>
                <ext:GridView runat="server" StripeRows="true" />
            </View>
            <DockedItems>
                <ext:Toolbar runat="server" Dock="Top">
                    <Items>
                        <ext:Button ID="btnAddNew" runat="server" Text="Thêm mới" Icon="ApplicationAdd">
                            <DirectEvents>
                                <Click OnEvent="btnAddNew_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button ID="btnEdit" runat="server" Text="Sửa" Icon="ApplicationEdit">
                            <DirectEvents>
                                <Click OnEvent="btnEdit_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button ID="btnDel" runat="server" Text="Xoá" Icon="ApplicationDelete">
                            <DirectEvents>
                                <Click OnEvent="btnDel_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                    <ExtraParams>
                                        <ext:Parameter Name="name" Value="btnDel"></ext:Parameter>
                                    </ExtraParams>
                                    <Confirmation ConfirmRequest="true"
                                        Title="Thông Báo" Message="Bạn có muốn xoá mẫu tin này không ?">
                                    </Confirmation>
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button ID="btnExport" runat="server" Text="Xuất tập tin" Icon="Printer">
                            <Menu>
                                <ext:Menu ID="MenuMain" runat="server">
                                    <Items>
                                        <ext:MenuItem ID="MenuItemExportExcel" runat="server" Text="Excel" Icon="PageExcel">
                                           <DirectEvents>
                                               <Click OnEvent="MenuItemExportExcel_Click" IsUpload="true"/>
                                           </DirectEvents>
                                        </ext:MenuItem>
                                    </Items>
                                </ext:Menu>
                            </Menu>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:DateField ID="txtDateBeginFillter" EmptyText="Từ ngày" runat="server" MarginSpec="0 8 0 0"/>
                        <ext:DateField ID="txtDateEndFillter" EmptyText="Đến ngày" runat="server" MarginSpec="0 5 0 0"/>
                        <ext:Button ID="btnFillter" runat="server" Text="Lọc" Icon="ApplicationGo" ToolTip="Chọn lọc theo ngày đặt hàng">
                            <DirectEvents>
                                <Click OnEvent="btnFillter_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                    </Items>
                </ext:Toolbar>
                <ext:Toolbar runat="server" Dock="Bottom" AnchorHorizontal="100%">
                    <Items>
                        <ext:TriggerField ID="txtSearch" runat="server" Width="200" EnableKeyEvents="true" MarginSpec="0 8 0 0">
                            <Triggers>
                                <ext:FieldTrigger Icon="Search" />
                            </Triggers>
                            <DirectEvents>
                                <TriggerClick OnEvent="Search_Event">
                                        <EventMask ShowMask="true" Msg="Đang tải..." />
                                </TriggerClick>
                                <SpecialKey OnEvent="Search_Event" Before="return e.getKey() == Ext.EventObject.ENTER;">
                                        <EventMask ShowMask="true" Msg="Đang tải..." />
                                </SpecialKey>
                            </DirectEvents>
                        </ext:TriggerField>
                        <ext:PagingToolbar ID="PagingToolbar1" runat="server" StoreID="StoreOrderBuy" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                    </Items>
                </ext:Toolbar>
            </DockedItems>
        </ext:GridPanel>
    </Content>
</ext:Panel>
<ext:Panel ID="PanelOrderBuyMain" runat="server">
    <Content>
        <%-----------WindowsOrderBuy-----------------%>
        <ext:Window ID="WindowsOrderBuy" runat="server"
            Title="Cập nhật mua hàng"
            Width="975"
            Height="583"
            Hidden="True"
            Region="Center"
            Modal="True"
            HideMode="Display"
            BOrderBuy="False"
            Padding="5"
            DefaultButton="btnSavePopUp"
            Resizable="True">
            <Items>
                <ext:Toolbar runat="server">
                    <Items>
                        <ext:Button runat="server" Text="Lưu lại" Icon="Disk" ID="btnSavePopUp">
                            <DirectEvents>
                                <Click OnEvent="btnSavePopUp_Click" Before="return #{FormPanelOrderBuy}.isValid();">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button runat="server" Text="Thêm vật tư" Icon="Add" ID="btnAddMaterial" MarginSpec="0 8 0 0">
                            <DirectEvents>
                                <Click OnEvent="btnAddMaterial_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button runat="server" Text="Xoá vật tư" Icon="Cancel" ID="btnDelMaterial" MarginSpec="0 8 0 0">
                            <DirectEvents>
                                <Click OnEvent="btnDelMaterial_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                    <ExtraParams>
                                        <ext:Parameter Name="name" Value="btnDel"></ext:Parameter>
                                    </ExtraParams>
                                    <Confirmation ConfirmRequest="true"
                                        Title="Thông Báo" Message="Bạn có muốn xoá vật tư này không ?">
                                    </Confirmation>
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:ToolbarSeparator />
                        <ext:Button runat="server" Text="Huỷ bỏ" Icon="Decline" ID="btnCancelPopUp">
                            <DirectEvents>
                                <Click OnEvent="btnCancelPopUp_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:TextField ID="txtOrderBuy_ID" runat="server" FieldLabel="ID" LabelAlign="Right" Hidden="true" />
                        <ext:TextField ID="txtOrder_ID" runat="server" FieldLabel="ID" LabelAlign="Right" Hidden="true" />
                    </Items>
                </ext:Toolbar>
                <ext:Panel
                runat="server" 
                Layout="ColumnLayout">
                    <Items>
                        <ext:Panel
                        runat="server" 
                        Width="218"
                        Frame="True"
                        MarginSpec="0 5 0 0"
                        Height="520">
                        <Items>
                            <ext:FormPanel ID="FormPanelOrderBuy" runat="server"
                                AutoHeight="true"
                                BodyPadding="4"
                                Frame="true"
                                DefaultAnchor="100%">
                                <Items>
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Mã đơn hàng" />
                                    <ext:FieldContainer ID="FieldContainer1"
                                            runat="server"
                                            AnchorHorizontal="100%"
                                            Layout="HBoxLayout">
                                            <Items>
                                                <ext:TextField ID="txtOrderBuyCode" runat="server" AllowBlank="False" Width="165" Margins="8 3 0 0" />
                                                <ext:Button runat="server" Text="" Icon="Reload" ID="btnRefreshOrderBuyCode" ToolTip="Click vào để tải lại mã" Margins="8 3 0 0">
                                                    <DirectEvents>
                                                        <Click OnEvent="btnRefreshOrderBuyCode_Click">
                                                            <EventMask ShowMask="true" Msg="Đang tải..." />
                                                        </Click>
                                                    </DirectEvents>
                                                </ext:Button>
                                            </Items>
                                        </ext:FieldContainer>
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="CT đặt hàng" />
                                    <ext:FieldContainer ID="FieldContainer2"
                                            runat="server"
                                            AnchorHorizontal="100%"
                                            Layout="HBoxLayout">
                                            <Items>
                                                <ext:TextField ID="txtOrder_Code" ReadOnly="True" runat="server" AllowBlank="True" Width="143" Margins="8 3 0 0" />
                                                <ext:Button runat="server" Text="" Icon="BulletGet" ID="btnAddOrderCode" ToolTip="Đến danh sách" Margins="8 3 0 0">
                                                    <DirectEvents>
                                                        <Click OnEvent="btnAddOrderCode_Click">
                                                            <EventMask ShowMask="true" Msg="Đang tải..." />
                                                        </Click>
                                                    </DirectEvents>
                                                </ext:Button>
                                                <ext:Button runat="server" Text="" Icon="Cancel" ID="btnDelOrderCode" ToolTip="Xoá danh sách" Margins="8 3 0 0">
                                                    <DirectEvents>
                                                        <Click OnEvent="btnDelOrderCode_Click">
                                                            <EventMask ShowMask="true" Msg="Đang tải..." />
                                                        </Click>
                                                    </DirectEvents>
                                                </ext:Button>
                                            </Items>
                                        </ext:FieldContainer>
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Ngày lập HĐ" Margins="8 3 0 0" />
                                    <ext:DateField ID="txtDateBegin" runat="server" AllowBlank="False" Width="250" MarginSpec="8 3 5 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Ngày đặt" Margins="8 3 0 0" />
                                    <ext:DateField ID="txtDateBeginPay" runat="server" AllowBlank="True" Width="250" MarginSpec="8 3 5 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Ngày giao" Margins="8 3 0 0" />
                                    <ext:DateField ID="txtDateEndPay" runat="server" AllowBlank="True" Width="250" MarginSpec="8 3 5 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Mã nhà cung cấp" MarginSpec="8 3 8 0" />
                                    <ext:TextField ID="txtCustomerAlias" ReadOnly="True" AllowBlank="False" runat="server" Width="250" MarginSpec="8 3 8 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Tên nhà cung cấp" MarginSpec="8 3 8 0" />
                                    <ext:FieldContainer ID="FieldContainer3"
                                        runat="server"
                                        AnchorHorizontal="100%"
                                        Layout="HBoxLayout">
                                        <Items>
                                            <ext:TextField ID="txtCustomerName" ReadOnly="True" Width="162" AllowBlank="False" runat="server" MarginSpec="8 3 0 0" />
                                            <ext:Button runat="server" Text="" Icon="BulletGet" ID="btnAddCustomer" ToolTip="Đến danh sách" MarginSpec="8 3 0 0">
                                                    <DirectEvents>
                                                    <Click OnEvent="btnAddCustomer_Click">
                                                        <EventMask ShowMask="true" Msg="Đang tải..." />
                                                    </Click>
                                                </DirectEvents>
                                            </ext:Button>
                                            <ext:Hidden runat="server" ID="txtCustomerID" AllowBlank="False"></ext:Hidden>
                                        </Items>
                                    </ext:FieldContainer>
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Mã số thuế" Margins="0 3 8 0" />
                                    <ext:TextField ID="txtTaxCode" runat="server" AnchorHorizontal="100%" MarginSpec="5 0 0 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Địa chỉ" MarginSpec="0 3 8 0" />
                                    <ext:TextField ID="txtCustomerAddress" ReadOnly="True" runat="server" AnchorHorizontal="100%" MarginSpec="5 0 0 0" />
                                    <ext:Label runat="server" LabelWidth="83" LabelAlign="Top" Text="Ghi chú" MarginSpec="0 3 8 0" />
                                    <ext:TextArea ID="txtDescription" runat="server" AnchorHorizontal="100%" Height="30" MarginSpec="5 0 0 0"/>
                                </Items>
                            </ext:FormPanel>
                        </Items>
                        </ext:Panel>
                        <ext:Panel
                        runat="server" 
                        Width="736"
                        Layout="Fit" 
                        BOrderBuy="False"
                        Height="455">
                            <Items>
                                <ext:GridPanel
                                ID="grOrderBuy_Detail"
                                Cls="grid-double"
                                runat="server"
                                EnableColumnMove="true"
                                AutoWidth="true"
                                AutoScroll="true"
                                Layout="Fit"
                                Height="195">
                                <Store>
                                    <ext:Store
                                        ID="StoreOrderBuy_Detail"
                                        runat="server"
                                        OnReadData="StoreOrderBuy_Detail_RefreshData">
                                        <Model>
                                            <ext:Model runat="server" IDProperty="Order_Buy_Detail_Id">
                                                <Fields>
                                                    <ext:ModelField Name="Rows_ID" Type="Int" />
                                                    <ext:ModelField Name="Order_Id" Type="Int" />
                                                    <ext:ModelField Name="Order_Buy_Id" Type="Int" />
                                                    <ext:ModelField Name="Materials_Id" Type="Int" />
                                                    <ext:ModelField Name="Materials_Alias" Type="String" />
                                                    <ext:ModelField Name="Materials_Name" Type="String" />
                                                    <ext:ModelField Name="Unit_Name" Type="String" />
                                                    <ext:ModelField Name="Order_Detail_Quality" Type="Int" />
                                                    <ext:ModelField Name="Order_Detail_Price" Type="Float" />
                                                    <ext:ModelField Name="Order_Detail_CK_Percent" Type="Float" />
                                                    <ext:ModelField Name="Order_Detail_CK" Type="Float" />
                                                    <ext:ModelField Name="Order_Detail_VAT_Percent" Type="Float" />
                                                    <ext:ModelField Name="Order_Detail_VAT" Type="Float" />
                                                    <ext:ModelField Name="Order_Detail_Total_Price" Type="Float" />
                                                </Fields>
                                            </ext:Model>
                                        </Model>
                                    </ext:Store>
                                </Store>
                                <ColumnModel runat="server">
                                    <Columns>
                                        <ext:RowNumbererColumn Text="STT" runat="server" Width="30" Align="Center" />
                                        <ext:Column runat="server" Text="Mã hàng" Width="100" DataIndex="Materials_Alias" />
                                        <ext:Column runat="server" Text="Tên hàng" Width="100" DataIndex="Materials_Name" />
                                        <ext:Column runat="server" Text="Đơn vị tính" Width="90" DataIndex="Unit_Name" />
                                        <ext:Column runat="server" Text="SL mua hàng" Width="90" DataIndex="Order_Detail_Quality">
                                            <Editor>
                                                <ext:NumberField runat="server" MinValue="0">
                                                </ext:NumberField>
                                            </Editor>
                                        </ext:Column>
                                        <ext:Column runat="server" AllowBlank="false" MinValue="0" Text="Đơn giá" Width="100" DataIndex="Order_Detail_Price">
                                                <Editor>
                                                <ext:NumberField runat="server" MinValue="0">
                                                </ext:NumberField>
                                            </Editor>
                                            <Renderer Fn="Ext.util.Format.numberRenderer('0,000')" />
                                        </ext:Column>
                                        <ext:NumberColumn runat="server" Text="Tiền CK" Width="90" DataIndex="Order_Detail_CK" Format="0,00" />
                                        <ext:Column runat="server" Text="CK %" Width="90" DataIndex="Order_Detail_CK_Percent">
                                            <Editor>
                                                <ext:NumberField runat="server" MinValue="0">
                                                </ext:NumberField>
                                            </Editor>
                                        </ext:Column>
                                        <ext:NumberColumn runat="server" Text="Tiền VAT" Width="90" DataIndex="Order_Detail_VAT" Format="0,00" />
                                        <ext:Column runat="server" Text="VAT %" Width="90" DataIndex="Order_Detail_VAT_Percent">
                                            <Editor>
                                                <ext:NumberField runat="server" MinValue="0">
                                                </ext:NumberField>
                                            </Editor>
                                        </ext:Column>
                                        <ext:NumberColumn runat="server" Text="Thành tiền" Width="90" DataIndex="Order_Detail_Total_Price" Format="0,00" /> 
                                    </Columns>
                                </ColumnModel>
                                <Plugins>
                                    <ext:RowEditing runat="server" SaveBtnText="Cập nhật" CancelBtnText="Hủy bỏ">
                                        <DirectEvents>
                                            <Edit OnEvent="UpdateMaterials_Click">
                                                <EventMask ShowMask="true" Msg="Đang tải..." />
                                                <ExtraParams>
                                                    <ext:Parameter Name="grOrderBuy_Detail" Value="Ext.encode(#{grOrderBuy_Detail}.getRowsValues({selectedOnly : true}))" Mode="Raw" />
                                                </ExtraParams>
                                            </Edit>
                                        </DirectEvents>
                                    </ext:RowEditing>
                                </Plugins>
                                <SelectionModel>
                                    <ext:CheckboxSelectionModel runat="server" Mode="Multi" />
                                </SelectionModel>
                                <DockedItems>
                                    <ext:Toolbar runat="server" Dock="Bottom" AnchorHorizontal="100%">
                                        <Items>
                                            <ext:PagingToolbar runat="server" StoreID="StoreOrderBuy_Detail" EmptyMsg="Không có dữ liệu" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                                        </Items>
                                    </ext:Toolbar>
                                </DockedItems>
                            </ext:GridPanel>
                            </Items>
                        </ext:Panel>
                        <ext:Panel
                        runat="server" 
                        Width="736"
                        MarginSpec="5 0 0 0"
                        BOrderBuy="True"
                        Frame="True"
                        Height="56">
                            <Items>
                                <ext:FieldContainer
                                runat="server"
                                AnchorHorizontal="100%">
                                <Items>
                                    <ext:Label runat="server" Text="Tổng số lượng vật tư:" MarginSpec="0 8 8 0"></ext:Label>
                                    <ext:Label ID="lbQualityWithOrderBuy" Cls="x-label-right-cost" runat="server" Text="0" Width="80"></ext:Label>

                                    <ext:Label runat="server" Text="Tổng đơn giá:" MarginSpec="0 8 8 0"></ext:Label>
                                    <ext:Label ID="lbPriceWithOrderBuy" Cls="x-label-right-cost" runat="server" Text="0" Width="80"></ext:Label>

                                    <ext:Label runat="server" Text="Tổng tiền CK:" MarginSpec="0 8 8 0"></ext:Label>
                                    <ext:Label ID="lbPriCKWithOrderBuy_Total" Cls="x-label-right-cost" runat="server" Text="0" Width="80"></ext:Label>

                                    <ext:Label runat="server" Text="Tổng tiền VAT:" MarginSpec="0 8 8 0"></ext:Label>
                                    <ext:Label ID="lbPriVATWithOrderBuy" Cls="x-label-right-cost" runat="server" Text="0" Width="80"></ext:Label>
                                </Items>
                            </ext:FieldContainer>
                                <ext:FieldContainer
                                runat="server"
                                AnchorHorizontal="100%">
                                <Items>
                                    <ext:Label runat="server" Text="Tổng tiền các mặt hàng bao gồm CK và VAT:" MarginSpec="0 8 8 0"></ext:Label>
                                    <ext:Label ID="lbTotalCostOrderBuyWithOrderBuy" Cls="x-label-right-cost" runat="server" Text="0"></ext:Label>
                                </Items>
                            </ext:FieldContainer>
                            </Items>
                        </ext:Panel>
                    </Items>
                </ext:Panel>
            </Items>
        </ext:Window>
        <%--------------Material-----------------%>
        <ext:Window ID="WindowMaterial" runat="server"
            Title="Thông tin vật tư"
            DefaultAnchor="100%"
            Width="829"
            Height="400"
            Hidden="true"
            AutoScroll="false"
            Maximizable="False"
            Minimizable="False"
            AutoDataBind="true"
            Region="Center"
            Resizable="False"
            Modal="true"
            Layout="Fit"
            HideMode="Offsets"
            Constrain="True">
            <Content>
                <ext:GridPanel
                    ID="grMaterial"
                    BOrderBuy="True"
                    runat="server"
                    AutoWidth="true"
                    AutoScroll="true"
                    Cls="gird"
                    EnableColumnMove="true">
                    <Store>
                        <ext:Store
                            ID="StoreMaterial"
                            runat="server"
                            OnReadData="StoreMaterial_RefreshData"
                            PageSize="10">
                            <Model>
                                <ext:Model runat="server" IDProperty="Materials_Id">
                                    <Fields>
                                        <ext:ModelField Name="Rows_ID" Type="Int" />
                                        <ext:ModelField Name="Materials_Alias" Type="String" />
                                        <ext:ModelField Name="Materials_Name" Type="String" />
                                        <ext:ModelField Name="Materials_Type_Name" Type="String" />
                                        <ext:ModelField Name="Unit_Name" Type="String" />
                                    </Fields>
                                </ext:Model>
                            </Model>
                        </ext:Store>
                    </Store>
                    <ColumnModel runat="server">
                        <Columns>
                            <ext:RowNumbererColumn runat="server" Width="30" Align="Center" />
                            <ext:Column runat="server" Text="ID" Width="15" DataIndex="Materials_Id" Visible="false"></ext:Column>
                            <ext:Column runat="server" Text="Mã vật tư" Width="100" DataIndex="Materials_Alias" Align="Left"></ext:Column>
                            <ext:Column runat="server" Text="Tên vật tư" Width="200" DataIndex="Materials_Name" Align="Left"></ext:Column>
                            <ext:Column runat="server" Text="Loại vật tư" Width="200" DataIndex="Materials_Type_Name" Align="Left"></ext:Column>
                            <ext:Column runat="server" Text="Đơn vị tính" Width="200" DataIndex="Unit_Name" Align="Center" Flex="1"></ext:Column>
                        </Columns>
                    </ColumnModel>
                    <SelectionModel>
                        <ext:CheckboxSelectionModel runat="server" Mode="Multi" />
                    </SelectionModel>
                    <TopBar>
                        <ext:Toolbar runat="server">
                            <Items>
                                <ext:Button ID="btnSelectMaterial" runat="server" Text="Chọn vật tư" Icon="Accept" ToolTip="Chọn vật tư">
                                    <DirectEvents>
                                        <Click OnEvent="btnSelectMaterial_Click">
                                            <EventMask ShowMask="true" Msg="Đang tải..." />
                                        </Click>
                                    </DirectEvents>
                                </ext:Button>
                            </Items>
                        </ext:Toolbar>
                    </TopBar>
                    <DockedItems>
                        <ext:Toolbar runat="server" Dock="Bottom" AnchorHorizontal="100%">
                            <Items>
                                <ext:PagingToolbar runat="server" StoreID="StoreMaterial" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                            </Items>
                        </ext:Toolbar>
                    </DockedItems>
                </ext:GridPanel>
            </Content>
        </ext:Window>
        <%--------------Customer-----------------%>
        <ext:Window ID="WindowCustomerOrderBuy" runat="server"
            Title="Thông tin khách hàng"
            DefaultAnchor="100%"
            Width="829"
            Height="400"
            Hidden="true"
            AutoScroll="false"
            Maximizable="False"
            Minimizable="False"
            AutoDataBind="true"
            Region="Center"
            Resizable="False"
            Modal="true"
            Layout="Fit"
            HideMode="Offsets"
            Constrain="True">
            <Content>
                <ext:GridPanel
                    ID="grCustomerOrderBuy"
                    BOrderBuy="True"
                    runat="server"
                    AutoWidth="true"
                    AutoScroll="true"
                    Cls="gird"
                    EnableColumnMove="true">
                    <Store>
                        <ext:Store
                            ID="StoreCustomerOrderBuy"
                            runat="server"
                            OnReadData="StoreCustomerOrderBuy_RefreshData"
                            PageSize="14">
                            <Model>
                                <ext:Model runat="server" IDProperty="Customer_ID">
                                    <Fields>
                                        <ext:ModelField Name="Customer_ID" Type="Int" />
                                        <ext:ModelField Name="Customer_Alias" Type="String" />
                                        <ext:ModelField Name="Customer_Name" Type="String" />
                                    </Fields>
                                </ext:Model>
                            </Model>
                        </ext:Store>
                    </Store>
                    <ColumnModel runat="server">
                        <Columns>
                            <ext:RowNumbererColumn runat="server" Width="30" Align="Center" />
                            <ext:Column runat="server" Text="Mã khách hàng" Width="100" DataIndex="Customer_Alias" Align="Left"></ext:Column>
                            <ext:Column runat="server" Text="Tên khách hàng" Width="100" DataIndex="Customer_Name" Align="Left" Flex="1"></ext:Column>
                        </Columns>
                    </ColumnModel>
                    <SelectionModel>
                        <ext:CellSelectionModel runat="server">
                            <DirectEvents>
                                <Select OnEvent="CellOrderBuyCustomer_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Select>
                            </DirectEvents>
                        </ext:CellSelectionModel>
                    </SelectionModel>
                    <DockedItems>
                        <ext:Toolbar runat="server" Dock="Bottom" AnchorHorizontal="100%">
                            <Items>
                                <ext:PagingToolbar runat="server" StoreID="StoreCustomerOrderBuy" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                            </Items>
                        </ext:Toolbar>
                    </DockedItems>
                </ext:GridPanel>
            </Content>
        </ext:Window>
        <%--------------Order-----------------%>
        <ext:Window ID="WindowOrderWithOrder" runat="server"
            Title="Thông tin đơn hàng"
            DefaultAnchor="100%"
            Width="829"
            Height="400"
            Hidden="true"
            AutoScroll="false"
            Maximizable="False"
            Minimizable="False"
            AutoDataBind="true"
            Region="Center"
            Resizable="False"
            Modal="true"
            Layout="Fit"
            HideMode="Offsets"
            Constrain="True">
            <Content>
                <ext:GridPanel
                    ID="grOrderWithOrder"
                    BOrderBuy="True"
                    runat="server"
                    AutoWidth="true"
                    AutoScroll="true"
                    Cls="gird"
                    EnableColumnMove="true">
                    <Store>
                        <ext:Store
                            ID="StoreOrderWithOrder"
                            runat="server"
                            OnReadData="StoreOrderWithOrder_RefreshData"
                            PageSize="14">
                            <Model>
                                <ext:Model runat="server" IDProperty="Order_Id">
                                    <Fields>
                                        <ext:ModelField Name="Rows_ID" Type="Int" />
                                        <ext:ModelField Name="Order_Id" Type="Int" />
                                        <ext:ModelField Name="Customer_Name" Type="String" />
                                        <ext:ModelField Name="Order_Code" Type="String" />
                                        <ext:ModelField Name="Order_DateBegin" Type="Date" />
                                        <ext:ModelField Name="Order_DateEnd" Type="Date" />
                                        <ext:ModelField Name="Order_Payment_Date" Type="Date" />
                                        <ext:ModelField Name="IsActive" Type="Boolean" />
                                    </Fields>
                                </ext:Model>
                            </Model>
                        </ext:Store>
                    </Store>
                    <ColumnModel runat="server">
                        <Columns>
                            <ext:RowNumbererColumn runat="server" Width="30" Align="Center" />
                            <ext:Column runat="server" Text="STT" Width="35" DataIndex="Rows_ID" Align="Center"></ext:Column>
                            <ext:Column runat="server" Text="ID" Width="15" DataIndex="Order_Id" Visible="false"></ext:Column>
                            <ext:Column runat="server" Text="Người đặt hàng" Width="200" DataIndex="Customer_Name"></ext:Column>
                            <ext:Column runat="server" Text="Chứng từ đặt" Width="100" DataIndex="Order_Code" Align="Left"></ext:Column>
                            <ext:DateColumn runat="server" Text="Ngày đặt" Width="100" DataIndex="Order_DateBegin" Format="dd-MM-yyyy" Align="Right" Flex="1"></ext:DateColumn>
                            <ext:DateColumn runat="server" Text="Ngày giao" Width="100" DataIndex="Order_DateEnd" Format="dd-MM-yyyy" Align="Right" Flex="1"></ext:DateColumn>
                            <ext:DateColumn runat="server" Text="Hạn thanh toán" Width="100" DataIndex="Order_Payment_Date" Format="dd-MM-yyyy" Align="Right" Flex="1"></ext:DateColumn>
                            <ext:CheckColumn runat="server" Text="Trạng thái" Width="75" DataIndex="IsActive" Align="Center"></ext:CheckColumn>
                        </Columns>
                    </ColumnModel>
                    <SelectionModel>
                        <ext:CellSelectionModel runat="server">
                            <DirectEvents>
                                <Select OnEvent="CellOrderWithOrder_Click">
                                    <EventMask ShowMask="true" Msg="Đang tải..." />
                                </Select>
                            </DirectEvents>
                        </ext:CellSelectionModel>
                    </SelectionModel>
                    <DockedItems>
                        <ext:Toolbar runat="server" Dock="Bottom" AnchorHorizontal="100%">
                            <Items>
                                <ext:PagingToolbar runat="server" StoreID="StoreOrderWithOrder" BeforePageText="Trang" AfterPageText="của {0}" LastText="Cuối" NextText="Kế tiếp" PrevText="Trở lại" FirstText="Đầu" RefreshText="Làm tươi" DisplayInfo="true" DisplayMsg="Trang {0} - {1} của {2}" />
                            </Items>
                        </ext:Toolbar>
                    </DockedItems>
                </ext:GridPanel>
            </Content>
        </ext:Window>
    </Content>
</ext:Panel>